<?php

/**
 * Tanaxia_Exceptionhandler.php
 *
 * The Tanaxia_Exceptionhandler handles any possible exception
 * 
 * Copyright 2009, Marcus Schumann - Tanax
 * Licensed under The MIT License - Modification, Redistribution allowed but must retain the above copyright notice
 * @link 		http://www.opensource.org/licenses/mit-license.php
 *
 * @package 	Tanaxia_Exceptionhandler - TAF
 * @created 	Aug 9th 2009
 * @version 	1.0
 * @link		-
 * 
 * @changelog
 * - 09/08/09	v1.0	Initial release
 */

class Tanaxia_Exceptionhandler
{

	private static $exceptions = array();
	
	public static function show($e)
	{
	
		self::$exceptions[] = $e;
	
		echo '<h1>Exception Message:</h1>';
		echo '<p>' . $e->getMessage() . '</p>';
		
		echo '<h1>Trace:</h1>';
		
		foreach($e->getTrace() as $trace)
		{
		
			$i = 0;
			foreach($trace as $ex)
			{
			
				echo '<p>';
				switch($i)
				{
				
					case 0:
						echo 'File: ';
						break;
						
					case 1:
						echo 'Line: ';
						break;
						
					case 2:
						echo 'Function: ';
						break;
						
					case 3:
						echo 'Class: ';
						break;
						
					case 4:
						echo '?? ';
						break;
						
					case 5:
						echo 'Array: ';
						break;
				
				}
				
				if(is_array($ex))
				{
				
					foreach($ex as $a)
					{
					
						if(is_array($a))
						{
						
							foreach($a as $b)
							{
							
								echo $b . '<br />';
							
							}
						
						}
						
						else echo $a . '<br />';
					
					}
				
				}
				
				else echo $ex;
				
				echo '</p>';
				$i++;
			
			}
			
			echo '<br />';
		
		}
	
	}
	
	
}


// End of Tanaxia_Exceptionhandler.php